<?php

namespace common\models;

use Yii;
use yii\data\Pagination;
/**
 * This is the model class for table "{{%website}}".
 *
 * @property integer $id
 * @property string $title
 * @property string $desc
 *
 * @property array website[] $websites
 */
class SysConfig extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%website_config}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title', 'keywords', 'desc', 'motto', 'copyright', 'recnumber'], 'required'],
            [['motto'], 'string'],
            [['title', 'keywords', 'desc'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '主键id',
            'title' => '文章标题',
            'keywords' => '关键字',
            'desc' => '文章描述',
            'copyright' => '版权',
            'recnumber' => '备案号',
            'motto' => '网站宗旨',
        ];
    }

    /**
     * 返回表中的配置文件的信息
     * @return array|null|\yii\db\ActiveRecord
     */
    public static function getFindOne()
    {
        return static::find()->orderBy('id desc')->asArray()->one();
    }
}
